define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Predepositresult,$stateParams,GoPage) {
		//:isSuccess/:payType/:money/:failReason/:isAfpay/:order_id
		//成功与否/支付方式/支付的金额/失败的原因/是否从支付页面跳转过来的/订单id
		$scope.isSuccess = $stateParams.isSuccess;
		$scope.payType = $stateParams.payType;//3微信	 4支付宝
		$scope.money = $stateParams.money;
		$scope.failReason = $stateParams.failReason;
		$scope.isAfpay = $stateParams.isAfpay;//'true'表示从afpay.html跳转过来的
		$scope.order_id = $stateParams.order_id;
		
		//支付结果--支付方式
		if($scope.payType=='1'){
			$scope.payName = "线下支付";
		}else if($scope.payType=='2'){
			$scope.payName = "预存款支付";
		}else if($scope.payType=='3'){
			$scope.payName = "微信支付";
		}else if($scope.payType=='4'){
			$scope.payName = "支付宝支付";
		}else if($scope.payType=='5'){
			$scope.payName = "授信支付";
		}else if($scope.payType=='6'){
			$scope.payName = "货到付款";
		}else if($scope.payType=='7'){
			$scope.payName = "公众号支付";
		}else{
			$scope.payName = "其他方式支付";
		}
		
		//页面跳转
		$scope.onshow_predeposit = function(){
			if($scope.isSuccess=="true"){
				GoPage.go_states("predepositwater");
			}else{
//				GoPage.go_states("predeposit");
				GoPage.go_back();
			}
		}
		$scope.onshow_afpay = function(){
			if($scope.isSuccess=="true"){
				GoPage.go_states("afall", { "type": 2 });
			}else{
				GoPage.go_states("afpay",{'order_id':$scope.order_id});
			}
		}
		
	}

	controller.$inject = ['$scope', 'Predepositresult','$stateParams','GoPage'];

	return app.registerController("predepositresultctrl",controller);
});